package com.ny.demo428;

public class Car extends Bx{
    private double price;
    private int number;
    @Override
    public double add() {
        double money;
        if(number==0){
            money = price*0.02;
        }
        else if(number==1){
            money = price+price*0.1;
        }
        else {
            money = price+price*0.2;
        }
        return money;

    }
    public Car(double price, int number) {
        this.price = price;
        this.number = number;
    }

    public Car() {

    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }
}
